//
//@File    :	10.4_stock10.h
//@Time    :	2021/08/26 21:45:56
//@Auther  :	Sun Sheng
//@Contact :	970340843@qq.com
//@Desc    :	Stock class declaration with constructors,destructor added
//

#ifndef STOCK10_H_
#define STOCK10_H_
#include<string>

class Stock
{
private:
    std::string company;
    long shares;
    double share_val;
    double total_val;
    void set_tot(){total_val=shares*share_val;}
public:
//two constructors(两个构造函数)
    Stock();//default constructor
    Stock(const std::string & co,long n=0,double pr=0.0);
    ~Stock();//noisy destructor(嘈杂的?析构函数)
    void buy(long num, double price);
    void sell(long num, double price);
    void update(double price);
    void show();
};

#endif
